package com.yunpeng.dishes.biz.services;

import com.yunpeng.dishes.dao.model.entity.DishesDO;
import com.yunpeng.dishes.dao.model.entity.MerchantDishesDO;
import com.yunpeng.dishes.dao.model.relation.DishesFoodIngredientsDO;
import com.yunpeng.dishes.dao.model.relation.DishesNutrientsDO;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * IDishesInternalService
 *
 * @author : Moore(hemw)
 * @date : 2020-03-27
 */
public interface IDishesInternalService {
    /**
     * 菜品保存服务
     *
     * @param dishesDO
     * @param dishesFoodIngredientsDOList
     * @param dishesNutrientsDOList
     * @return
     */
    @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 3600, rollbackFor = Exception.class)
    void saveMerchantDishes(MerchantDishesDO dishesDO, List<DishesFoodIngredientsDO> dishesFoodIngredientsDOList, List<DishesNutrientsDO> dishesNutrientsDOList);

    /**
     * 复制为菜品模版
     * @param dishesDO
     * @param dishesFoodIngredientsDOList
     * @param dishesNutrientsDOList
     */
    @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 3600, rollbackFor = Exception.class)
    void copyToDishesTemplate(DishesDO dishesDO, List<DishesFoodIngredientsDO> dishesFoodIngredientsDOList, List<DishesNutrientsDO> dishesNutrientsDOList);
}
